package net.magicalcloud.magicalcloud.presenter;

import net.magicalcloud.magicalcloud.AppApplication;
import net.magicalcloud.magicalcloud.base.BasePresenter;
import net.magicalcloud.magicalcloud.entity.Files;
import net.magicalcloud.magicalcloud.execption.CloudExecption;
import net.magicalcloud.magicalcloud.listener.CloudListener;
import net.magicalcloud.magicalcloud.model.IFileModel;
import net.magicalcloud.magicalcloud.model.modelImpl.FileModel;
import net.magicalcloud.magicalcloud.view.IRecycleView;

import java.util.List;

/**
 * Created by Administrator on 2018/6/8.
 */

public class RecyclePresenter extends BasePresenter<IRecycleView>{
    private IFileModel fileModel = new FileModel();

    public void show(){
        int userId = AppApplication.getCurrentUser().getId();
        fileModel.showRecycle(userId, new CloudListener<List<Files>>() {
            @Override
            public void done(List<Files> object, CloudExecption e) {
                if(e==null){
                    getView().setList(object);
                }
                else {
                    getView().setList(null);
                }
            }
        });
    }
}
